﻿{% load i18n %}
{% extends "base.html" %}
{% block header %}
<script src='/static/js/jquery.blockUI.js' type="text/javascript"></script>
<script type="text/javascript">
{%if postback%}
$(document).ready(function() {
  $.getJSON("/admin/import_next", next_result);
  function next_result(json)
  {
    $('#list').prepend('<li>'+json[0]+':'+json[1]+'</li>')
    if (json[2])
    {
         $.getJSON("/admin/import_next", next_result);
    }

  }

});
{%else%}

    $(document).ajaxError(function(request, settings){
       $('#bmsg').html('Error<br/><input type="button" value="Ok" onclick="$.unblockUI()"></input>');
       $('.blockUI').css('cursor','');
   });


{%endif%}
</script>

{% endblock %}

{% block nav2 %}
<div id="dnav2">
 <a href="/admin/setup"  >{%trans "Basic" %}</a>
 <a href="/admin/import" class="current">{%trans "Import/Export" %}</a>
 <a href="/admin/sitemap">{%trans "Sitemap" %}</a>
 <a href="/admin/tools">{%trans "Tools" %}</a>
</div>
{% endblock %}

 {% block content %}
    {%if postback%}
    Importing．．．：<br>
    <ul id="list"></ul>



    {%else%}
<script language="javascript" type="text/javascript" src="/static/My97DatePicker/WdatePicker.js"></script>
    <div class="wrap">
            <h2>{%trans "Export/Import for wordpress"%}</h2>
            <h3>{%trans "Export"%}</h3>
            <p>{%trans "Export as  WordPress eXtended RSS file"%}</p> 
            <form action="/admin/export/micolog.xml" method='get'>
              {%trans "Export from Date:"%}<input type="text" name="date_begin" disabled onClick="WdatePicker()" />
              {%trans "to Date:"%}<input type="text" name="date_end" disabled onClick="WdatePicker()" />{%trans "'s posts"%}<br /><br />
                <input type="checkbox" name="all" value="on" checked 
                onclick="javascript:
              if(this.checked){
                form.date_begin.disabled=true;
                form.date_end.disabled=true;     
              }else{
                form.date_begin.disabled=false;
                form.date_end.disabled=false;
                }" />{%trans "Export all posts"%}<br />
                <input type="submit" value={%trans "Export"%} />
            </form>
<h3>{%trans "Import"%}</h3>
<p>{%trans "Please select a file which exported from wordpress to import!"%}</p>
    <form action="" method='post' enctype="multipart/form-data">
    <table class="form-table">
     <tr valign="top">
                <th scope="row">{%trans "Permalink Structure:"%}</th>
                <td><input type="text" name="link_format"  size="65" value="{{ blog.link_format }}" >
                <br>{%trans "Available parameters:"%}%(year)s , %(month)s , %(day)s , %(postname)s , %(post_id)s
               </td>
                </tr>
      <tr valign="top">
                <th scope="row">{%trans "Wordpress export file (WXR file):"%}</th>
                <td><input type="file" name="wpfile">
               </td>
                </tr>


    </table>
    <p>
    <input type="submit" value="{% trans "Import"%}"/>{%if error%} <span id="import_msg" class="error">{{error}}</span>{%endif%}
    </p>

</form>

</div>
{%endif%}
{% endblock %}
